﻿using System;
using System.Collections.Generic;
using CustomORM.Extensions;
using NUnit.Framework;

namespace CustomORM.Tests.CustomORM.Extensions
{
    [TestFixture]
    class SqlQueryExtensionToCommaSeparatedStringTest
    {
        [Test]
        public void EmptyListTest()
        {
            IEnumerable<int> list = new List<int>();
            Assert.Throws<ArgumentException>(() => list.ToCommaSeparatedString());
        }

        [Test]
        public void NullListTest()
        {
            IEnumerable<int> list = null;
            Assert.Throws<ArgumentException>(() => list.ToCommaSeparatedString());
        }

        [Test]
        public void OneElementList()
        {
            IEnumerable<int> list = new List<int>() {1};
            Assert.That(list.ToCommaSeparatedString(), Is.EqualTo("1"));
        }

        [Test]
        public void ListTest()
        {
            IEnumerable<int> list = new List<int>() {1, 2, 3, 4, 5, 6, 7};
            Assert.That(list.ToCommaSeparatedString(), Is.EqualTo("1,2,3,4,5,6,7"));
        }
    }
}
